package auction

class Listing {
    String name
    Date endDate
    String startingBid
    String description
    Customer seller
    Customer winner

    // bids corresponding to this listing
    static hasMany = [bids: Bid]

    static constraints = {
            // name must be less than 64
             name size: 0..63

             // description must be less than 256
             description nullable: true, size: 0..255

             // end date must be in the future
             endDate(validator: {it > new Date()})

             // winner must allow nulls since there is no winner until the listing ends
             winner nullable: true
         }
}
